<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Hello React</title>
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<div id="app"></div>
<div id="change"></div>
<script type="text/babel">

    class App extends React.Component {

        constructor() {
            super();
            this.state = {
                cnt: 0
            }
            this.cli = this.cli.bind(this)
        }

        cli = function () {
            this.setState({
                cnt: this.state.cnt + 1
            })
        };

        render() {
            return (
                <div>
                    <h1>点击了{this.state.cnt} 次</h1>
                    <button onClick={this.cli}>点击</button>
                </div>
            )
        }
    }
    const root = ReactDOM.createRoot(document.getElementById('root'));
    root.render(<App/>)

</script>
</body>
</html>